<template>
    <view class="container">

        <uni-section title="自定义图片大小" type="line">
            <view class="example-body custom-image-box">
                <text class="text">选择头像</text>
                <uni-file-picker limit="1" :del-icon="false" disable-preview file-mediatype="image" @select="select"
                    @progress="progress" @success="success" @fail="fail">选择</uni-file-picker>
            </view>
            <button class="mini-btn" type="primary" size="mini" @click="upload">按钮</button>
        </uni-section>



    </view>
</template>
<script setup lang="ts">

const upload = (e: any)=>{
    
    console.log('select'+e.tempFile)
}

const select = (e: any)=>{
    
    console.log(e.tempFilePaths)
    
    uni.uploadFile({
        url:'http://47.109.30.151:8002/fileOss/uploadFile',
        filePath:e.tempFilePaths[0],
        name:'file',
        success:res =>{
            console.log(res.data, "头像")
        }
    })
}
const progress = (e: any)=>{
    console.log('progress'+e)
}
const success = (e: any)=>{
    
}
const fail = (e: any)=>{
    
}


</script>
<style lang="scss">
.example-body {
    padding: 10px;
    padding-top: 0;
}

.custom-image-box {
    /* #ifndef APP-NVUE */
    display: flex;
    /* #endif */
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.text {
    font-size: 14px;
    color: #333;
}
</style>
